package cn.com.common;

import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author jiaming
 */
@Data
public class RegistryInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    private String root;
    private String host;
    private int port;
    private String appName;

    /**
     * 只监听节点，不注册
     */
    private boolean isListener = false;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RegistryInfo that = (RegistryInfo) o;
        return port == that.port && root.equals(that.root) && host.equals(that.host) && appName.equals(that.appName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(root, host, port, appName);
    }

    @Override
    public String toString() {
        return "RegistryInfo{" +
                "root='" + root + '\'' +
                ", host='" + host + '\'' +
                ", port=" + port +
                ", appName='" + appName + '\'' +
                ", isListener=" + isListener +
                '}';
    }
}